<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>其它改动</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="migration71.changed-functions.html">« 变动的函数</a></li>
      <li style="float: right;"><a href="migration71.windows-support.html">Windows 支持 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="migration71.html">从 PHP 7.0.x 移植到 PHP 7.1.x</a></li>
    <li>其它改动</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="migration71.other-changes" class="sect1">
 <h2 class="title">其它改动</h2>

 <div class="sect2" id="migration71.other-changes.apprise-on-arithmetic-with-invalid-strings">
  <h3 class="title">无效字符串计算的通知和警告</h3>

  <p class="para">
   New <strong><code>E_WARNING</code></strong> and <strong><code>E_NOTICE</code></strong> errors
   have been introduced when invalid strings are coerced using operators
   expecting numbers (<code class="literal">+</code> <code class="literal">-</code>
   <code class="literal">*</code> <code class="literal">/</code> <code class="literal">**</code>
   <code class="literal">%</code> <code class="literal">&lt;&lt;</code> <code class="literal">&gt;&gt;</code>
   <code class="literal">|</code> <code class="literal">&amp;</code> <code class="literal">^</code>) or their
   assignment equivalents. An <strong><code>E_NOTICE</code></strong> is emitted when the
   string begins with a numeric value but contains trailing non-numeric
   characters, and an <strong><code>E_WARNING</code></strong> is emitted when the string
   does not contain a numeric value.
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #DD0000">'1b'&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #DD0000">'something'</span><span style="color: #007700">;</span>
</span>
</code></div>
   </div>

   <p class="para">以上例程会输出：</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Notice: A non well formed numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect2" id="migration71.other-changes.warn-on-octal-overflow">
  <h3 class="title">八进制转义序列溢出时发出警告</h3>

  <p class="para">
   Previously, 3-octet octal string escape sequences would overflow silently.
   Now, they will still overflow, but <strong><code>E_WARNING</code></strong> will be
   emitted.
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #DD0000">"\500"</span><span style="color: #007700">);</span>
</span>
</code></div>
   </div>

   <p class="para">以上例程会输出：</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Warning: Octal escape sequence overflow \500 is greater than \377 in %s on line %d
string(1) &quot;@&quot;
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect2" id="migration71.other-changes.inconsistency-fixes-to-this">
  <h3 class="title"><code class="literal">$this</code> 不一致的修正</h3>

  <p class="para">
   Whilst <code class="literal">$this</code> is considered a special variable in PHP, it
   lacked proper checks to ensure it wasn&#039;t used as a variable name or
   reassigned. This has now been rectified to ensure that
   <code class="literal">$this</code> cannot be a user-defined variable, reassigned to a
   different value, or be globalised.
  </p>
 </div>

 <div class="sect2" id="migration71.other-changes.session-id-generation-without-hashing">
  <h3 class="title">无需散列即可生成 Session ID</h3>

  <p class="para">
   Session ID 将不再在生成时进行哈希。这一变化，会导致以下四个
   ini 设置不再使用：
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">session.entropy_file</code>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">session.entropy_length</code>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">session.hash_function</code>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">session.hash_bits_per_character</code>
    </span>
   </li>
  </ul>

  <p class="para">
   并增加以下两个 ini 设置：
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">session.sid_length</code> - 定义会话 ID 的长度（为了向后兼容，默认为 32 个字符）
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">session.sid_bits_per_character</code> - 定义了每个字符的存储位数（即增加了会话
     ID 中可使用的字符范围），为了向后兼容，默认为 4
    </span>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration71.other-changes.ini-file-handling">
  <h3 class="title">INI 文件处理的变化</h3>
  <dl>
   
    <dt>
<code class="parameter">precision</code></dt>

    <dd>

     <p class="para">
       If the value is set to -1, then the dtoa mode 0 is used. The default
       value is still 14.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">serialize_precision</code></dt>

    <dd>

     <p class="para">
       If the value is set to -1, then the dtoa mode 0 is used. The value -1 is
       now used by default.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">gd.jpeg_ignore_warning</code></dt>

    <dd>

     <p class="para">
       The default of this <var class="filename">php.ini</var> setting has been changed to 1, so by
       default libjpeg warnings are ignored.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">opcache.enable_cli</code></dt>

    <dd>

     <p class="para">
       The default of this <var class="filename">php.ini</var> setting has been changed to 1
       (enabled) in PHP 7.1.2, and back to 0 (disabled) in PHP 7.1.7.
     </p>
    </dd>

   
  </dl>

 </div>

 <div class="sect2" id="migration71.other-changes.session-id-csprng-gen">
  <h3 class="title">Session ID generation with a CSPRNG only</h3>

  <p class="para">
   Session IDs will now only be generated with a CSPRNG.
  </p>
 </div>

 <div class="sect2" id="migration71.other-changes.typeerror-error-messages">
  <h3 class="title">More informative <span class="classname"><a href="class.typeerror.html" class="classname">TypeError</a></span> messages when <strong><code>null</code></strong> is allowed</h3>
  <p class="para">
   <span class="classname"><a href="class.typeerror.html" class="classname">TypeError</a></span> exceptions for arg_info type checks will
   now provide more informative error messages. If the parameter type or return
   type accepts <strong><code>null</code></strong> (by either having a default value of <strong><code>null</code></strong> or being a
   nullable type), then the error message will now mention this with a message
   of &quot;must be ... or null&quot; or &quot;must ... or be null.&quot;
  </p>
 </div>
</div></div></div></body></html>